<?php

namespace app\common\model\jeek;

use think\Model;


class Order extends Model
{

    

    

    // 表名
    protected $name = 'jeek_order';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];
    

    
    // 开启批量赋值
    protected $allowField = [
        'user_id', 'goods_id', 'taocan_id', 
         'price', 'quantity', 'status',
        'order_no', 'createtime', 'updatetime'
    ];







    public function taocan()
    {
        return $this->belongsTo('app\common\model\jeek\order\Taocan', 'id', 'product_id', [], 'LEFT')->setEagerlyType(0);
    }


    public function admin()
    {
        return $this->belongsTo('app\common\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function user()
    {
        return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
